﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AimGameLibrary.GameObject
{

    public class GameFloat : GameBaseValue
    {
        float myfloat;
        public float MyfloaT { get { myfloat = (float)GetParentValue(); return myfloat; } set { myfloat = value; SetParentValue(myfloat); } }

        public override void LoadData(Identification getdata, int IndexData, NodeData node)
        {
            InputMode = (NodeInputMode)getdata.Items.GetValue(IndexData + 1);

            if (InputMode == NodeInputMode.Float_1)
                Listnameparent.Add(node.Data);
            else MyfloaT = (float)getdata.Items.GetValue(IndexData + 2);
        }

        protected override object GetParentValue()
        {
            if (this.Listparent.Count > 0)
            {
                if (InputMode == NodeInputMode.Float_1
                    && Listparent[0].GetType() == typeof(GameFloat))
                {
                    GameFloat tempparent = (GameFloat)Listparent[0];
                    return tempparent.MyfloaT;
                }
                else return myfloat;
            }
            else return myfloat;
        }

        protected override void SetParentValue(object obj)
        {
            if (this.Listparent.Count > 0)
            {
                if (InputMode == NodeInputMode.Float_1)
                    if (Listparent[0].GetType() == typeof(GameFloat))
                    {
                        GameFloat tempparent = (GameFloat)Listparent[0];
                        tempparent.MyfloaT = (float)obj;
                    }
            }
        }
    }
}
